<template>
	<div class="div_wrapper">
		<div class="content_wrapper">
			<el-row class="my_row">
				<el-col :span="24">
					<el-form :model="setData" ref="numberValidateForm" label-width="400px" class="demo-ruleForm">
						<el-form-item label="" prop="leavelimit" :rules="[
                { required: true, message: '不能为空'},
                { type: 'number', message: '必须为数字值'}
              ]">
							<span slot="label">请假申请【时长】超限(天)自动提交下级审批</span>
							<el-input type="age" v-model.number="setData.leavelimit" class="w400" autocomplete="off"></el-input>
						</el-form-item>
						<el-form-item label="辅导员审批销假的时间" prop="removelimit" :rules="[
                { required: true, message: '不能为空'},
                { type: 'number', message: '必须为数字值'}
              ]">
							<span slot="label">销假申请【实际入校时间点】超限(天)自动提交下级审批</span>
							<el-input type="age" v-model.number="setData.removelimit" class="w400" autocomplete="off"></el-input>
						</el-form-item>
						<el-form-item label="" prop="imgname" :rules="[
                { required: true, message: '不能为空'},
              ]">
							<span slot="label">入校申请【上传图片】的文字描述</span>
							<el-input v-model="setData.imgname" class="w400" autocomplete="off"></el-input>
						</el-form-item>
						<el-form-item>
							<el-button type="primary" @click="submitForm('numberValidateForm')">保存</el-button>
							<!-- <el-button @click="resetForm('numberValidateForm')">重置</el-button> -->
						</el-form-item>
					</el-form>
				</el-col>
			</el-row>
		</div>
	</div>
</template>

<script>
	import Vue from "vue";

	export default {
		name: "settime",
		data() {
			return {
				setData: {
					id: '',
					imgname: '',
					leavelimit: '',
					removelimit: '',
				}
			};
		},

		created() {
			this.GetData();
		},
		methods: {
			//获取人员列表
			GetData() {
				let that = this;
				that.postAxios("/SysSetting/GetSysSetting", null).then((res) => {
					if(res.code == 0) {
						that.setData = res.data;
					}
				})
			},
			submitForm(formName) {
				let that = this;
				this.$refs[formName].validate((valid) => {
					if(valid) {
						that.postAxios("/SysSetting/EditSysSetting", that.setData).then((res) => {
							if(res.code == 0) {
								that.$notify({
									title: '成功',
									message: '操作成功',
									type: 'success'
								});
								//						that.GetTableList();
							} else {
								that.$notify.error({
									title: '错误',
									message: '操作失败'
								});
							}
						})
					} else {
						console.log('error submit!!');
						return false;
					}
				});
			},
			resetForm(formName) {
				this.$refs[formName].resetFields();
			}

		}
	};
</script>

<style scoped lang="scss">
	.w400 {
		width: 200px;
	}
	
	.font_bold {
		font-weight: bold;
		font-size: 16px;
	}
	
	.div_wrapper {
		height: 100%;
		width: 100%;
		background: #fff;
	}
	
	.content_wrapper {
		padding-top: 40px;
		.my_row {
			padding-top: 40px;
		}
	}
</style>